
' 基础测试
Private Sub test_SQLTranslateSingleColInfo_base()
    Dim singleColInfo As SqlTranslateSingleColInfo
    Set singleColInfo = New SqlTranslateSingleColInfo


    ' 设置列所在的表名 token
    Dim tableNameToken As SqlToken
    Set tableNameToken = New SqlToken
    tableNameToken.Init "table1", SqlTokenType.STR_NAME

    singleColInfo.setTableNameToken tableNameToken

    ' 设置表的列名 token
    Dim colNameToken As SqlToken
    Set colNameToken = New SqlToken
    colNameToken.Init "cx1", SqlTokenType.STR_NAME

    singleColInfo.setColNameToken colNameToken

    Dim colInfo As ISqlTranslateColInfo
    Set colInfo = singleColInfo

    ' 检查原始列名
    Debug.Assert colInfo.getOriginColName() = "cx1"
    Debug.Assert colInfo.getTranslatedColName() = "cx1"

    ' 设置变换后列名
    colInfo.setTranslatedColName "realCx1"
    Debug.Assert colInfo.getOriginColName() = "cx1"
    Debug.Assert colInfo.getTranslatedColName() = "realCx1"

    ' 设置变换后列名后，原始 token 中的内容也会被修改
    Debug.Assert colNameToken.value = "realCx1"

    ' 检查列所在的表名
    Debug.Assert colInfo.getTableName() = "table1"

    ' 设置列所在表的别名
    colInfo.setTableAliasName("t1")
    Debug.Assert colInfo.getTableAliasName() = "t1"

    ' 设置列所在表的别名后，原始 token 中的内容也会被修改
    Debug.Assert tableNameToken.value = "t1"

    ' 检查当前列的别名
    Dim colAliasNameToken As SqlToken
    Set colAliasNameToken = New SqlToken
    colAliasNameToken.Init "XXX", SqlTokenType.STR_NAME
    Debug.Assert colInfo.getAliasName() = ""
    colInfo.setAliasNameToken colAliasNameToken
    Debug.Assert colInfo.getAliasName() = "XXX"
End Sub

